from typing import Optional
from pydantic import BaseModel, ConfigDict
from uuid import UUID


class AggregatesRead(BaseModel):
    media_unique_outlets: float
    media_report_count: float
    social_total_interactions: float
    index_growth_rate: float
    details: Optional[dict] = None


class CollectResult(BaseModel):
    collected_news: int
    collected_weibo: int


class EvidenceItem(BaseModel):
    id: UUID
    type: str
    path_or_url: str
    captured_at: Optional[str] = None

    model_config = ConfigDict(from_attributes=True, json_encoders={UUID: str})


class EvidenceList(BaseModel):
    items: list[EvidenceItem]


class CollectionConfigRead(BaseModel):
    activity_id: UUID
    keywords_json: Optional[str] = None
    accounts_json: Optional[str] = None


class CollectionConfigUpdate(BaseModel):
    keywords: Optional[list[str]] = None
    accounts: Optional[dict] = None
